<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>事件处理方法</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <button v-on:click="greet">Greet</button>
    </div>
</body>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            name: 'vue.js'
        },
        // 在 'methods' 对象中定义方法
        methods: {
            greet: function(event){
                alert('Hello ' + this.name + '!')
                // 'event' 是原生 DOM事件
                if(event) {
                    alert(event.target.tagName)
                }
            }
        }
    })
</script>
</html>